// pages/productiveness/productiveness.js
import {
  lgRequest
} from '../../utils/ajax'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    img:'https://www.mengbaoonline.com:8182/profile/upload/2022/10/24/a9fe65e034f2bd0ba3d796d6d5eab686.png',
    imgN:'https://www.mengbaoonline.com:8182/profile/upload/2022/10/24/47d84f5a281f3dc8f16908004636c1de.png',
    headList:[
      {name:'网络组',state:0},
      {name:'运维组',state:1},
      {name:'其他',state:2},
    ],
    tabIndex:0,
    peopleList:[]
  },
    // 字典
    dictionariesX() {
      lgRequest('getCodeX', {}, {
        doSuccess: r => {
          console.log(r, '字典获取值')
        }
      })
    },
  
  // 人员统计
  hoemPeople(num) {
    let params = {
      userGroup:num+1 || 1
    }
    console.log(num,'num');
    lgRequest('renyuanTongji', params, {
      doSuccess: r => {
        console.log(r, '人员统计')
        this.setData({
          peopleList:r.data
        })
      }
    })
  },
  // 切换tab
  toggleTab(e){
    this.hoemPeople(e.currentTarget.dataset.tabindex)
    this.setData({
      tabIndex:e.currentTarget.dataset.tabindex
    })
  },
  goXLE(e) {
    var data = JSON.stringify(e.currentTarget.dataset.item)
    wx.navigateTo({
      url: '/pages/XLE/xle?item='+data,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.hoemPeople()
    this.dictionariesX()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})